<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="./css/public.css">
    <link rel="stylesheet" href="./css/sign.css">
    <script src="./js/jquery.js"></script>
    <script src="./js/layer/layer.js"></script>
</head>

<body>
    <header>
        <img class="logo" src="./images/注册页图片/logo.jpg" alt="">
        <ul class="ul_nav">
            <li class="lis">
                <a href="./index.html">联想首页</a>
            </li>
            <li class="lis">
                <a href="https://shop.lenovo.com.cn">商城</a>
            </li>
            <li class="lis">
                <a href="https://b.lenovo.com.cn/">企业购</a>
            </li>
            <li class="lis">
                <a href="https://newsupport.lenovo.com.cn/">服务</a>
            </li>
            <li class="lis">
                <a
                    href="https://i.lenovo.com.cn/memberInfo/v2/center.jhtml?sts=e40e7004-4c8a-4963-8564-31271a8337d8&amp;_ga=2.70748307.222010594.1632271014-332828211.1631927989">会员</a>
            </li>
            <li class="lis">
                <a href="https://club.lenovo.com.cn/">社区</a>
            </li>
            <li class="lis">
                <a href="https://mall.lenovo.com.cn/">门店</a>
            </li>
            <li class="lis">
                <a href="https://brand.lenovo.com.cn/">品牌</a>
            </li>
            <img class="phone" src="./images/注册页图片/phone.png" alt="">
        </ul>
    </header>
    <section>
        <div class="background">
            <img src="./images/登录页图片/下载.jpg" alt="">
            <div class="signinBox">
                <div class="signin">
                    <h2>联想会员登录</h2>
                    <form>
                        <p><input type="text" name="name" value="" placeholder="输入用户名" class="infbox"></p>
                        <p><input type="text" name="pwd" value="" placeholder="输入密码" class="infbox"></p>
                        <input type="checkbox" class="autoSign">自动登录
                        <br><button>登录</button>
                        <br><a href="" class="phoneSign">手机验证码快捷登录</a>
                        <a href="./register.html" class="register">立即注册</a>
                    </form>
                    <p class="line">——————其他登录方式——————</p>

                </div>
            </div>
        </div>

    </section>

    <footer>
        <div class="company_news">
            <p>版权所有：1998-2021 联想集团|<a href="https://shop.lenovo.com.cn/investor/html/legal.html"
                    target="_blank">法律公告</a>|<a href="https://www.lenovo.com.cn/statement/privacy.html"
                    target="_blank">隐私权政策</a></p>
            <p>京ICP备11035381|京公网安备110108007970号|营业执照：110000410127232</p>
        </div>
    </footer>

    <script>
        $(function () {
            $("form").on("submit", function () {
                var data = $("form").serialize();
                $.ajax({
                    url: "/login",
                    type: "post",
                    data: data
                }).then(function (res) {
                    console.log(res);
                    let {
                        code,
                        msg,
                        data
                    } = res;
                    if (code == 200) {
                        //就把data保存到
                        sessionStorage.setItem("userInfo", JSON.stringify(data));
                        //是否跳转到主页
                        layer.confirm("登录成功!是否立即跳转", {
                            btn: ["确定", "取消"]
                        }, (index) => {
                            layer.close(index);
                            location.href = "./index.html";
                        }, () => {
                        })
                    } else {
                        layer.msg(msg);
                    }


                })

                return false;
            })
        })
    </script>
    
</body>

</html>